from argparse import ArgumentParser

parser = ArgumentParser("ptest", "ptest <book> <sn>", "test english phrase")

parser.add_argument("book", type=str, help="which book")
parser.add_argument("num", type=int, help="which one?")

parser.add_argument("-c", "--color", type=str, help="what is the color?")
parser.add_argument("-d", dest="date", type=str, help="which date", required=True)

# -m 则 modify: True, 没有 -m 则为 False
parser.add_argument("-m", dest="modify", action="store_true", help="modify the file?")

args = parser.parse_args()
print(dict(args._get_kwargs()), "<--")
print(args)
print(dir(args))

print(args.book, args.num)
